<template>
  <div class="PT_intro">
    <!-- <div class="box"></div> -->
    <van-popup v-model:show="visible" round class="" @close="close">
      <div v-if="state.info" class="point_location_intro">
        <div class="flex gap-sm">
          <div class="thumbnail">
            <img :src="baseUrl + state.info.img" alt="">
          </div>
          <div>
            <div>
              <span class="title">{{ state.info.name }}</span><span v-if="state.info.distance" class="distance m-l-1 b-rd pa-1">{{
                state.info.distance
              }}</span>
            </div>
            <div class="game_type m-t-2">
              <img :src="`https://jwc-static.jdwxk.com/imgs/map/type/${state.info.type}.png`" alt="">
            </div>
          </div>
        </div>
        <div class="divider" />
        <div class="intro">
          {{ state.info.intro }}
        </div>
      </div>
      <!-- <div v-if="state.info" class="box" /> -->
    </van-popup>
  </div>
</template>

<script setup>
import { defineExpose } from 'vue'

const baseUrl = import.meta.env.VITE_PUBLIC_PATH

const visible = ref(false)
const state = reactive({
  info: null,
})
function open(item) {
  // 请求
  state.info = item
  console.log('open', item, state.info)
  visible.value = true
}
function close() {
  state.guid = ''
  state.info = null
  visible.value = false
}
defineExpose({ open })
</script>

<style lang="scss">
.PT_intro {
  color: #333333;
  .van-overlay {
    width: 100vh;
    height: 100vw;
    left: 0;
  }
  .van-popup {
    max-width: none;
    height: calc(60vw + 60px);
    background-color: transparent !important;
  }
  .van-popup--center {
    top: 75px;
    transform: translateY(0%);
  }
  .box {
    border-bottom: 27px solid white;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    transform: rotate(180deg);
    width: 52px;
    margin-top: -1px;
    margin-left: calc(25vh - 26px);
  }

  .point_location_intro {
    width: 50vh;
    // height: 60vw;
    background-color: white;
    border-radius: 20px;
    box-sizing: border-box;
    padding: 20px;

    .thumbnail img {
      width: 68px;
      height: 60px;
      border-radius: 12px;
    }
    .title {
      font-size: 14px;
      font-weight: bold;
    }
    .distance {
      background-color: #f3e2d2;
      color: #bc7e7e;
      font-size: 12px;
    }
    .game_type img {
      width: 77px;
      height: 26px;
    }
    .divider {
      border-bottom: 1px dashed #d5c3a5;
      margin: 15px 0 12px 0;
    }
    .intro {
      height: calc(60vw - 60px - 40px - 27px);
      overflow-y: scroll;
      text-align: justify;
      font-weight: bold;
    }
  }
}
</style>
